//
//  HMSearchViewModel.m
//  HowToDo
//
//  Created by qu on 2017/1/6.
//  Copyright © 2017年 KY. All rights reserved.
//

#import "HMSearchViewModel.h"
#import "HMSearchModel.h"
#import "HMNetWorkTool.h"
#import <YYModel/YYModel.h>
@implementation HMSearchViewModel

+ (void)loadDataWith:(NSString *)str finishBlock:(void(^)(id result))finishBlock
{
    [[HMNetWorkTool sharedTool] requestSearchResultJsonDataWithStr:str Finished:^(id responseObject) {
        
        NSArray *result = [NSArray yy_modelArrayWithClass:[HMSearchModel class] json:responseObject[@"data"][@"audio"]];
        finishBlock(result);
    } Failed:^(NSError *error) {
       NSLog(@"error:%@",error);
        
    }];
    
}

+ (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper {
    
    return @{@"tid":@"id"};
}
@end
